<%--
  Created by IntelliJ IDEA.
  User: DongZhengWei
  Date: 2018/8/23
  Time: 15:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	String _id=request.getParameter("_");
%>

<form id="member_input_form" class="form-horizontal">

	<div class="form-group">
		<label class="col-md-2 control-label">成员姓名</label>
		<div class="col-md-8">
			<input type="text" class="form-control" id="username" name="username" placeholder="成员姓名" />
		</div>
	</div>

	<div class="form-group">
		<label class="col-md-2 control-label">登录账号</label>
		<div class="col-md-8">
			<input type="text" class="form-control" id="account" name="account" placeholder="用户名/手机号/邮箱" />
		</div>
	</div>

	<div class="form-group">
		<label class="col-md-2 control-label">登录密码</label>
		<div class="col-md-8">
			<input type="password" class="form-control" id="password" name="password" placeholder="请输入登录密码" />
		</div>
	</div>

	<div class="form-group">
		<label class="col-md-2 control-label">密码确认</label>
		<div class="col-md-8">
			<input type="password" class="form-control" id="password2" name="password2" placeholder="请再次输入密码" />
		</div>
	</div>

</form>

<script>

	$(function(){
        fn_member_input_validate();
	});

	function fn_member_input_validate(){
	    __init_validate("member_input_form", {
	        rules : {
                username : {
                    required : true
				},
                account : {
                    required : true,
                    remote : {
                        url : "<%=path%>/main/member/checkAccount",
                        message : "已经存在此账号了",
                        delay : 500,
                        type : "POST",
						data : {
                            account : function(){
                                return $("#account").val();
							}
						}
					}
				},
                password : {
                    required : true
				},
                password2 : {
                    required : true,
                    equalTo : "#password"
				}
			},
			messages : {
                username : {
                    required : "请输入成员姓名"
				},
                account : {
                    required : "请输入登录账号",
                    remote : "已经存在有此账号了"
				},
                password : {
                    required : "请输入登录账号"
				},
                password2 : {
                    required : "请输入密码确认",
                    equalTo : "两次密码不一致"
				}
			}
		})
	}

	function fn_member_input_save(callback){
		if($("#member_input_form").valid()){
			__confirm_dialog(null, "确定提交吗？", function(){
				__form_save("member_input_form", "<%=path%>/main/member/create", function(data){
				    callback(data.state == 1);
				})
			})
		}else{
		    callback();
		}
	}

</script>